﻿using System;
using System.Web;
using System.Web.UI.WebControls;
namespace Fjaspx
{
    /// <summary>
    /// 页面扩展基础类
    /// </summary>
    public class BasePage : System.Web.UI.Page
    {
        /// <summary>
        /// 预先实例化
        /// </summary>
        public Fjaspx.Sys.Bll.ROYcms_news ___ROYcms_news_Bll = new Fjaspx.Sys.Bll.ROYcms_news();
        public Fjaspx.Sys.Model.ROYcms_news ___ROYcms_news_Model = new Fjaspx.Sys.Model.ROYcms_news();
        public Fjaspx.Sys.Bll.ROYcms_class ___ROYcms_class_Bll = new Fjaspx.Sys.Bll.ROYcms_class();
        public Fjaspx.Sys.Model.ROYcms_class ___ROYcms_class_Model = new Fjaspx.Sys.Model.ROYcms_class();
        public Fjaspx.Sys.Bll.ROYcms_user ___ROYcms_user_bll = new Fjaspx.Sys.Bll.ROYcms_user();
        public Fjaspx.Sys.Model.ROYcms_user ___ROYcms_user_model = new Fjaspx.Sys.Model.ROYcms_user();
        public Fjaspx.Sys.Bll.ROYcms_New_User ___ROYcms_New_User_bll = new Fjaspx.Sys.Bll.ROYcms_New_User();
        public Fjaspx.Sys.Model.ROYcms_New_User ___ROYcms_New_User_model = new Fjaspx.Sys.Model.ROYcms_New_User();
        public Fjaspx.Sys.Bll.ROYcms_Class_UGroup ___ROYcms_Class_UGroup_bll = new Fjaspx.Sys.Bll.ROYcms_Class_UGroup();
        public Fjaspx.Sys.Model.ROYcms_Class_UGroup ___ROYcms_Class_UGroup_model = new Fjaspx.Sys.Model.ROYcms_Class_UGroup();
        public Fjaspx.Sys.Bll.ROYcms_UGroup ___ROYcms_UGroup_bll = new Fjaspx.Sys.Bll.ROYcms_UGroup();
        public Fjaspx.Sys.Model.ROYcms_UGroup ___ROYcms_UGroup_model = new Fjaspx.Sys.Model.ROYcms_UGroup();
        public Fjaspx.Sys.Model.ROYcms_Workflow ___ROYcms_Workflow_model = new Fjaspx.Sys.Model.ROYcms_Workflow();
        public Fjaspx.Sys.BLL.ROYcms_Workflow ___ROYcms_Workflow_bll = new Fjaspx.Sys.BLL.ROYcms_Workflow();
        public Fjaspx.Sys.Bll.Page ___Page = new Fjaspx.Sys.Bll.Page();
        public Fjaspx.Sys.Model.ROYcms_UGroup_Workflow ___ROYcms_UGroup_Workflow_model = new Fjaspx.Sys.Model.ROYcms_UGroup_Workflow();
        public Fjaspx.Sys.Bll.ROYcms_UGroup_Workflow ___ROYcms_UGroup_Workflow_bll = new Fjaspx.Sys.Bll.ROYcms_UGroup_Workflow();
        public Fjaspx.Sys.Model.ROYcms_Flash ___ROYcms_Flash_model = new Fjaspx.Sys.Model.ROYcms_Flash();
        public Fjaspx.Sys.BLL.ROYcms_Flash ___ROYcms_Flash_bll = new Fjaspx.Sys.BLL.ROYcms_Flash();
        public Fjaspx.Sys.Model.ROYcms_Rss ___ROYcms_Rss_model = new Fjaspx.Sys.Model.ROYcms_Rss();
        public Fjaspx.Sys.BLL.ROYcms_Rss ___ROYcms_Rss_bll = new Fjaspx.Sys.BLL.ROYcms_Rss();
        public Fjaspx.Sys.Model.ROYcms_Objet ___ROYcms_Objet_model = new Fjaspx.Sys.Model.ROYcms_Objet();
        public Fjaspx.Sys.BLL.ROYcms_Objet ___ROYcms_Objet_bll = new Fjaspx.Sys.BLL.ROYcms_Objet();
        public Fjaspx.Sys.Model.ROYcms_Form ___ROYcms_Form_model = new Fjaspx.Sys.Model.ROYcms_Form();
        public Fjaspx.Sys.BLL.ROYcms_Form ___ROYcms_Form_bll = new Fjaspx.Sys.BLL.ROYcms_Form();
        public Fjaspx.Sys.Model.ROYcms_Form_class_classkind ___ROYcms_Form_class_classkind_model = new Fjaspx.Sys.Model.ROYcms_Form_class_classkind();
        public Fjaspx.Sys.BLL.ROYcms_Form_class_classkind ___ROYcms_Form_class_classkind_bll = new Fjaspx.Sys.BLL.ROYcms_Form_class_classkind();
        public Fjaspx.Sys.Model.ROYcms_News_Group ___ROYcms_News_Group_model = new Fjaspx.Sys.Model.ROYcms_News_Group();
        public Fjaspx.Sys.BLL.ROYcms_News_Group ___ROYcms_News_Group_bll = new Fjaspx.Sys.BLL.ROYcms_News_Group();
        public Fjaspx.Sys.Model.ROYcms_Tag ___ROYcms_Tag_model = new Fjaspx.Sys.Model.ROYcms_Tag();
        public Fjaspx.Sys.BLL.ROYcms_Tag ___ROYcms_Tag_bll = new Fjaspx.Sys.BLL.ROYcms_Tag();

        /// <summary>
        /// 获得配置文件信息
        /// </summary>
        public Fjaspx.Sys.Model.ROYcmsConfig ___WebConfig = Fjaspx.Config.ROYcmsConfig.Get_Config();
        public string ___WebConfigValue(string name)
        {
            return Fjaspx.Config.ROYcmsConfig.Get_Config(name);
        }
        public string ___CmsConfigValue(string name)
        {
            return Fjaspx.Config.ROYcmsConfig.GetCmsConfigValue(name);
        }
        /// <summary>
        /// 覆盖系统默认的错误页
        /// </summary>
        protected override void OnError(EventArgs e)
        {
            //  if(___WebConfig.)
            //string MexBoxContent = Fjaspx.Common.SystemCms.Read_File(Server.MapPath("~/administrator/SystemTemplate/MexBox.htm"), "utf-8");
            //HttpContext ctx = HttpContext.Current;
            //Exception exception = ctx.Server.GetLastError();
            //string errorInfo =
            //    "\r\n<br /><b>发生错误的 URL:</b> <font color=red>" + ctx.Request.Url.ToString() +
            //    "</font>" +
            //    "\r\n<br /><b>错误源: </b> <font color=red>" + exception.Source +
            //    "</font>" +
            //    "\r\n<br /><b>错误信息: </b> <font color=red>" + exception.Message +
            //    "</font>" +
            //    "\r\n<br /><b>Stack trace: </b> <br /><font color=red>" + exception.StackTrace +
            //    "</font>";
            //MexBoxContent = MexBoxContent.Replace("{$IndexPage}", ___WebConfig.web_host);
            //MexBoxContent = MexBoxContent.Replace("{$message}", errorInfo);
            ////写入错误日志
            //Fjaspx.Common.SystemCms.InsertErrLog(errorInfo, ctx.Request.Url.ToString());

            //ctx.Response.Write(MexBoxContent);
            //ctx.Server.ClearError();
            //base.OnError(e);

        }
    }

    /// <summary>
    /// 页面扩展基础类
    /// </summary>
    public class UserControlBasePage : System.Web.UI.UserControl
    {
        /// <summary>
        /// 预先实例化
        /// </summary>
        public Fjaspx.Sys.Bll.ROYcms_news ___ROYcms_news_Bll = new Fjaspx.Sys.Bll.ROYcms_news();
        public Fjaspx.Sys.Model.ROYcms_news ___ROYcms_news_Model = new Fjaspx.Sys.Model.ROYcms_news();
        public Fjaspx.Sys.Bll.ROYcms_class ___ROYcms_class_Bll = new Fjaspx.Sys.Bll.ROYcms_class();
        public Fjaspx.Sys.Model.ROYcms_class ___ROYcms_class_Model = new Fjaspx.Sys.Model.ROYcms_class();
        /// <summary>
        /// 获得配置文件信息
        /// </summary>
        public Fjaspx.Sys.Model.ROYcmsConfig ___WebConfig = Fjaspx.Config.ROYcmsConfig.Get_Config();
        /// <summary>
        /// 覆盖系统默认的错误页
        /// </summary>
        protected override void OnError(EventArgs e)
        {
            //string MexBoxContent = Fjaspx.Common.SystemCms.Read_File(Server.MapPath("~/administrator/SystemTemplate/MexBox.htm"), "utf-8");
            //HttpContext ctx = HttpContext.Current;
            //Exception exception = ctx.Server.GetLastError();
            //string errorInfo =
            //    "\r\n<br /><b>发生错误的 URL:</b> <font color=red>" + ctx.Request.Url.ToString() +
            //    "</font>" +
            //    "\r\n<br /><b>错误源: </b> <font color=red>" + exception.Source +
            //    "</font>" +
            //    "\r\n<br /><b>错误信息: </b> <font color=red>" + exception.Message +
            //    "</font>" +
            //    "\r\n<br /><b>Stack trace: </b> <br /><font color=red>" + exception.StackTrace +
            //    "</font>";
            //MexBoxContent = MexBoxContent.Replace("{$IndexPage}", ___WebConfig.web_host);
            //MexBoxContent = MexBoxContent.Replace("{$message}", errorInfo);
            ////写入错误日志
            //Fjaspx.Common.SystemCms.InsertErrLog(errorInfo, ctx.Request.Url.ToString());

            //ctx.Response.Write(MexBoxContent);
            //ctx.Server.ClearError();
            //base.OnError(e);

        }
    }
}
